#!/usr/bin/perl -w
# vim:tw=100 sw=2 expandtab ft=perl
#
# Example:
#
# file_comment => {
#   '/etc/sysctl.conf' => [ qr/net.ipv6/ ],
# },
# file_uncomment => {
#   '/etc/sysctl.conf' => [ qr/net.ipv4/ ],
# },
#


my %comment = flatten_hash(c("$hostname/file_comment"));
while (my($file, $regex) = each(%comment)) {
  $regex = [ $regex ] unless ref $regex eq 'ARRAY';
  file_comment(-file => $file, -match => $regex)
}

my %uncomment = flatten_hash(c("$hostname/file_uncomment"));
while (my($file, $regex) = each(%uncomment)) {
  $regex = [ $regex ] unless ref $regex eq 'ARRAY';
  file_uncomment(-file => $file, -match => $regex)
}
